package com.cckat.service.impl;

import com.cckat.mapper.AdminRoleMapper;
import com.cckat.service.AdminRoleService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * @author 静海基地
 */
@DubboService
public class AdminRoleServiceImpl implements AdminRoleService {

    @Autowired
    private AdminRoleMapper adminRoleMapper;

    @Override
    public void assignRole(Long adminId, List<Long> roleIds) {
        //先将中间表中和该用户相关的数据全部删除，在重新分配
        adminRoleMapper.deleteByAdminId(adminId);
        adminRoleMapper.assignRole(adminId, roleIds);
    }
}
